#ifndef CATEGORYSETTINGS_H
#define CATEGORYSETTINGS_H
#include "commodityattribute.h"

#include <QWidget>
class InquireSql;
class QTreeWidgetItem;


namespace Ui {
class CategorySettings;
}

enum category{categoryPage = 4};

class CategorySettings : public QWidget
{
    Q_OBJECT
    
public:
    explicit CategorySettings(QWidget *parent = 0);
    ~CategorySettings();
    void displayCategory();
    void displayChildCategory(QTreeWidgetItem *&, QString);
    void onlyShowTreeWidget();
    void showAll();
//    void set_lineEditCategoryPress(bool value) {lineEditCategoryPress = value;}
    bool get_lineEditCategoryPress() {return lineEditCategoryPress;}
    bool eventFilter(QObject *target, QEvent *event);
    
protected:
    void keyPressEvent(QKeyEvent *);

signals:
    void displaycategory(QString);
//    void signalUpdateComboBoxAttribute(int);

private slots:
    void on_pushButtonNew_clicked();

//    void on_treeWidgetCategory_itemClicked(QTreeWidgetItem *item, int column);

    void on_pushButtonDelete_clicked();

    void on_pushButtonModify_clicked();

    void on_treeWidgetCategory_itemDoubleClicked(QTreeWidgetItem *item, int column);

    void on_treeWidgetCategory_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);

private:
    bool lineEditCategoryNameIsEmpty();
    bool categoryIsExist();       

    Ui::CategorySettings *ui;

    InquireSql *m_sql;

    attributelist m_list;

    bool lineEditCategoryPress;

    bool clearTreeWidgetCategory;

    bool isOnlyShowTreeWidget;
};

#endif // CATEGORYSETTINGS_H
